﻿using Abp.Configuration.Startup;
using Abp.EntityFramework;
using Abp.EntityFrameworkCore;
using Abp.Modules;
using Basefr.Data.EntityFrameworkCore;
using Basefr.Modules;
using System.Transactions;

namespace Basefr.Data
{
    [DependsOn(
        typeof(AbpEntityFrameworkCoreModule),
        typeof(Basefr.Module),
        typeof(Basefr.Core.Module))]
    public class Module : ModuleBase<Module>
    {
        public override void PreInitialize()
        {
            //使用自定义的EntityFinder代替ABP的默认实现，ABP默认的必须在DbContext中把Entity定义为DbSet<>，否则就不识别
            Configuration.ReplaceService<IDbContextEntityFinder, DbContextEntityFinder>();

            //设置默认的事务隔离级别
            Configuration.UnitOfWork.IsolationLevel = IsolationLevel.ReadCommitted;
        }
    }
}
